home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / dev / basic / MethodBBLib.lha / MethodBBLib / Userlibs / MethodBBLib.asc
Text File  |  1997-07-27  |  5KB  |  183 lines

  1. ;$VER:MethodBBLib V1.4 (26.07.97)
  2. ;
  3. ;(C)opyright 1997 by Erwan Fouret
  4. ;
  5. ;
  6.  
  7. ;***************************************************
  8. ;*  V1.4 : Command VarArgs added by Julian Kinraid *
  9. ;*  V1.0 : First release                           *
  10. ;***************************************************
  11.  
  12. #methodbblib=XX ;put here a free lib number
  13.  
  14. !libheader {#methodbblib,0,0,0,0}
  15.  
  16. !acommand  {#long}
  17. !args      {#long,#long}
  18. !libs
  19. !subs      {_DoMethodA,0,0}
  20. !name      {"DoMethodA","(Obj,Message)"}
  21.  
  22. !acommand  {#long}
  23. !repargs   {1,1,#long,#long}
  24. !libs
  25. !subs      {_DoMethod,0,0}
  26. !name      {"DoMethod","(Obj,MethodID,Tag[,Tag..])"}
  27.  
  28. !acommand  {#long}
  29. !args      {#long,#long,#long}
  30. !libs
  31. !subs      {_DoSuperMethodA,0,0}
  32. !name      {"DoSuperMethodA","(Class,Obj,Message)"}
  33.  
  34. !acommand  {#long}
  35. !repargs   {2,1,#long,#long,#long}
  36. !libs
  37. !subs      {_DoSuperMethod,0,0}
  38. !name      {"DoSuperMethod","(Class,Obj,MethodID,Tag[,Tag..])"}
  39.  
  40. !acommand  {#long}
  41. !args      {#long,#long,#long}
  42. !libs
  43. !subs      {_CoerceMethodA,0,0}
  44. !name      {"CoerceMethodA","(Class,Obj,Message)"}
  45.  
  46. !acommand  {#long}
  47. !repargs   {2,1,#long,#long,#long}
  48. !libs
  49. !subs      {_CoerceMethod,0,0}
  50. !name      {"CoerceMethod","(Class,Obj,MethodID,Tag[,Tag..])"}
  51.  
  52. !acommand  {#long}
  53. !repargs   {2,1,#long,#long,#long}
  54. !libs
  55. !subs      {_SetSuperAttrs,0,0}
  56. !name      {"SetSuperAttrs","(Class,Obj,Tag[,Tag..])"}
  57.  
  58. ;***** Code added by Julian Kinraid (jkinraid@clear.net.nz) *****
  59.                                                                ;*
  60. !afunction {#long}                                             ;*
  61. !repargs   {0,1,#long}                                         ;*
  62. !libs                                                          ;*
  63. !subs      {_VarArgs,0,0}                                      ;*
  64. !name      {"VarArgs","(Tag[,Tag..])"}                         ;*
  65.                                                                ;*
  66. ;****************************************************************
  67.  
  68. !libfin
  69.  
  70. ._DoMethodA:
  71.         TST.l   d0
  72.         BEQ.b   cmnullreturn
  73.         MOVE.l  d0,a2
  74.         MOVE.l  d1,a1
  75.         MOVE.l  -4(a2),a0
  76.         BRA     cminvoke
  77.  
  78. ._DoMethod:
  79.         TST.l   d0
  80.         BEQ.b   cmnullreturn
  81.         LEA.l   args(pc),a1
  82.         MOVE.l  a1,d1
  83.         SUBQ    #1,d7
  84. Loop:   MOVE.l  -(a2),(a1)+
  85.         DBF     d7,Loop
  86.         MOVE.l  d0,a2
  87.         MOVE.l  d1,a1
  88.         MOVE.l  -4(a2),a0
  89.         BRA     cminvoke
  90.  
  91. ._DoSuperMethodA:
  92.         MOVE.l  d1,a2
  93.         BEQ.b   cmnullreturn
  94.         MOVE.l  d0,a0
  95.         BEQ.b   cmnullreturn
  96.         MOVE.l  d2,a1
  97.         MOVEA.l $18(a0),a0
  98.         BRA     cminvoke
  99.  
  100. ._DoSuperMethod:
  101.         LEA.l   args(pc),a1
  102.         MOVE.l  a1,d2
  103.         SUBQ    #1,d7
  104. Loop1:  MOVE.l  -(a2),(a1)+
  105.         DBF     d7,Loop1
  106.         MOVE.l  d1,a2
  107.         BEQ.b   cmnullreturn
  108.         MOVE.l  d0,a0
  109.         BEQ.b   cmnullreturn
  110.         MOVE.l  d2,a1
  111.         MOVEA.l $18(a0),a0
  112.         BRA     cminvoke
  113.  
  114. ._CoerceMethodA:
  115.         MOVE.l  d1,a2
  116.         BEQ.b   cmnullreturn
  117.         MOVE.l  d0,a0
  118.         BEQ.b   cmnullreturn
  119.         MOVE.l  d2,a1
  120.         BRA     cminvoke
  121.  
  122. ._CoerceMethod:
  123.         LEA.l   args(pc),a1
  124.         MOVE.l  a1,d2
  125.         SUBQ    #1,d7
  126. Loop2:  MOVE.l  -(a2),(a1)+
  127.         DBF     d7,Loop2
  128.         MOVE.l  d1,a2
  129.         BEQ.b   cmnullreturn
  130.         MOVE.l  d0,a0
  131.         BEQ.b   cmnullreturn
  132.         MOVE.l  d2,a1
  133.         BRA     cminvoke
  134.  
  135. ._SetSuperAttrs:
  136.         LEA.l   args(pc),a1
  137.         MOVE.l  a1,d2
  138.         SUBQ    #1,d7
  139. Loop3:  MOVE.l  -(a2),(a1)+
  140.         DBF     d7,Loop3
  141.         MOVE.l  d1,a2
  142.         BEQ.b   cmnullreturn
  143.         MOVE.l  d0,a0
  144.         BEQ.b   cmnullreturn
  145.         MOVEA.l $18(a0),a0
  146.         MOVE.l  #0,-(a7)
  147.         MOVE.l  d2,-(a7)
  148.         MOVE.l  #$103,-(a7)
  149.         LEA.l   (a7),a1
  150.         PEA.l   ssaret(pc)
  151.         MOVE.l  8(a0),-(a7)
  152.         RTS
  153.  
  154. cminvoke:
  155.         PEA.l   cmreturn(pc)
  156.         MOVE.l  8(a0),-(a7)
  157.         RTS
  158.  
  159. cmnullreturn:
  160.         MOVEQ   #0,d0
  161.  
  162. cmreturn:
  163.         RTS
  164.  
  165. ssaret:
  166.         LEA.l   $c(a7),a7
  167.         MOVEA.l (a7)+,a2
  168.         RTS
  169.  
  170. ;***** Code added by Julian Kinraid (jkinraid@clear.net.nz) *****
  171.                                                                ;*
  172. ._VarArgs                                                      ;*
  173.         LEA     args(pc),a1                                    ;*
  174.         MOVE.l  a1,d0                                          ;*
  175.         SUBQ    #1,d7                                          ;*
  176. Loop4:  MOVE.l  -(a2),(a1)+                                    ;*
  177.         DBF     d7,Loop4                                       ;*
  178.         RTS                                                    ;*
  179.                                                                ;*
  180. ;****************************************************************
  181.  
  182. args:           Dcb.l   20,0
  183.